console.log(1); // 1
setTimeout(() => { console.log(2) });
process.nextTick(() => { console.log(3); });
setImmediate(() => { console.log(4) });
new Promise(resolve => {
    console.log(5); // 2
    resolve();
    console.log(6); // 3
}).then(() => {
    console.log(7)
});
Promise.resolve().then(() => {
    console.log(8);
    process.nextTick(() => {
        console.log(9)
    });
});
// 1 5 6 3 7 8 9 2 4